// @ts-nocheck
export const translateTreeToList = (nodeTree, pid = '') => {
  const nodeList = [];
  const dfs = (nodeTree, pid) => {
    if (Array.isArray(nodeTree)) {
      nodeTree.forEach((node) => {
        dfs(node, pid);
      });
    } else {
      const { children, ...node } = nodeTree;
      nodeList.push(Object.assign(node, { pid }));
      if (children) {
        dfs(children, node.id);
      }
    }
  };
  dfs(nodeTree, pid);
  return nodeList;
};
